#include "TextBox.h"

TextBox::TextBox()
{
	canvas = NULL;
	d_id = 1;
}
TextBox::TextBox(string _text,int _x, int _y, int _w, int _h, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_text,_x,_y,_w,_h,d_textbox));
}
TextBox::TextBox(string _text,int _x, int _y, int _w, int _h,Color c, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_text,_x,_y,_w,_h,c,d_textbox));
}
TextBox::TextBox(string _text, int _x, int _y, int _w, int _h, Color c, Color bg, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_text,_x,_y,_w,_h,c,bg,d_textbox));
}

void TextBox::setWidth(uint _w)
{
	if(canvas != NULL)
		canvas->getDrawing(d_id).setWidth(_w);
}
void TextBox::setHeight(uint _h)
{
	if(canvas != NULL)
		canvas->getDrawing(d_id).setHeight(_h);
}
void TextBox::setSize(Size s)
{
	if(canvas != NULL)
		canvas->getDrawing(d_id).setSize(s);
}
int TextBox::getHeight()
{
	if(canvas != NULL)
		return canvas->getDrawing(d_id).getHeight();
	return 0;
}
bool TextBox::contains(int x, int y)
{
	if(canvas != NULL)
		return canvas->getDrawing(d_id).contains(x,y);
	return false;
}
